<?php

class CodeSpace_Jplugins_Controller_Plugin_Jplugins extends Zend_Controller_Plugin_Abstract{
    
    public function routeStartup (Zend_Controller_Request_Abstract $request)
    {

    }
 
    public function routeShutdown (Zend_Controller_Request_Abstract $request)
    {

        $jpluginOptions = new Zend_Config_Ini(APPLICATION_PATH . '/configs/jplugins.ini', 'settings');
        $jpluginOptions = $jpluginOptions->toArray();
        
        $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
        $view = $viewRenderer->view;
   	    
   	    $view->addHelperPath("ZendX/JQuery/View/Helper", "ZendX_JQuery_View_Helper");
   	    $view->addHelperPath("CodeSpace/Jplugins/View/Helper", "CodeSpace_Jplugins_View_Helper");
   	    
   	    $view->jquery()->enable();
    	$view->jquery()->setVersion($jpluginOptions['jqueryversion']);
    	
        if($request->isXmlHttpRequest()){
	        $view->jquery()->setRenderMode(
	            ZendX_JQuery::RENDER_SOURCES |
	            ZendX_JQuery::RENDER_STYLESHEETS |
	            ZendX_JQuery::RENDER_JAVASCRIPT |
	            ZendX_JQuery::RENDER_JQUERY_ON_LOAD    
	        );
        }else 
        {

        }
        
        
    }
}

?>